package com.leetcode.week.week292;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author angzhijin
 * @Description
 * @create 2022-05-08 10:31 上午
 */
public class week1 {
    public static void main(String[] args) {

    }

    public static String largestGoodInteger(String num) {
        List<String> list  = new ArrayList<>();
        for (int i = 2; i < num.length(); i++) {
            char ch = num.charAt(i);
            if(ch==num.charAt(i-1) && ch==num.charAt(i-2)){
                list.add(num.substring(i-2,i+1));
            }
        }
        if(list.size()==0) return "";
        Collections.sort(list);
        return list.get(list.size()-1);
    }
}
